package com.liu.ai.chat;

import com.alibaba.cloud.ai.dashscope.api.DashScopeApi;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;
import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatOptions;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatResponse;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.ollama.api.OllamaApi;
import org.springframework.ai.ollama.api.OllamaOptions;
import org.springframework.web.client.RestClient;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Flux;

import java.util.function.BiFunction;

@Slf4j
public class DashScopeChat {

    private static final String apiKey = "sk-d1c41de66c074fc686488ab227d32fbe";


    public static void main(String[] args) throws InterruptedException {

        DashScopeApi dashScopeApi = new DashScopeApi(apiKey);

        DashScopeChatModel chatModel = new DashScopeChatModel(dashScopeApi);
        DashScopeChatOptions options = DashScopeChatOptions.builder()
                .withModel("qwen-max")
                .build();
        ChatResponse res = ChatClient.builder(chatModel)
                .defaultOptions(options)
                .build()
                .prompt("介绍一下你自己")
                .call()
                .chatResponse();

        System.out.println(res);

        Thread.sleep(1000 * 60 * 40);
    }

}

